Method, apparatus, and system for switching transport stream

ABSTRACT

Disclosed herein is a method of switching a transport stream. The method comprises receiving a plurality of different input streams, receiving a switching command for a first input stream that belongs to the plurality of input streams and that is now output, searching for an out-point of the first input stream and an in-point of a second input stream that is newly output, in response to the switching command, inserting a virtual P picture stream between the out-point and the in-point, and performing switching from the first input stream into the second input stream based on the out-point and the in-point.

Priorities to Korean patent application number 10-2013-0070093 filed onJun. 19, 2013 and Korean patent application number 10-2014-0067662 filedon Jun. 3, 2014, the entire disclosure of which is incorporated byreference herein, is claimed.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a method, apparatus, and system forswitching a transport stream and, more particularly, to an MPEG-2Transport Stream (TS) switching apparatus and method for switching andoutputting a single MPEG-2 TS that belong to two or more MPEG-2 TSsoutput by different encoders and that is selected in response to aswitching command from a user.

2. Discussion of the Related Art

FIG. 1 is a diagram illustrating an example of an in-point and out-pointfor the switching of an MPEG-2 TS.

Referring to FIG. 1, a conventional MPEG-2 TS switching method includesa TS switching method, that is, a method provided by ISO/IEC 1381-1MPEG-2 systems. A “switching point of time” is divided into an“in-point” and an “out-point”. The in-point is a point of time at whicha new stream may be switched and entered, and the out-point is a pointof time at which a stream may switch into an existing stream. In anexisting TS switching method, for the seamless and continuous switchingof an image as in FIG. 1, after a picture suitable for restrictionconditions appears, switching is started using a corresponding point asa switching point of time. The picture suitable for the restrictionconditions means that in the case of the out-point, the last pictureneeds to be an I or P picture on the basis of a Presentation Time Stamp(PTS) and the start of a video stream of a newly replaced stream (e.g.,a B stream in FIG. 1) needs to be an I picture. Furthermore, a B picture(i.e., a B picture indicated by dotted lines in the B stream) behind theI picture of the in-point needs to be encoded so that it does not refervideo before the in-point. If not, there is a problem in that a decodermay not properly restore the B picture because information about animage referred by the B picture indicated by the dotted lines is unableto be obtained.

FIG. 2 is a diagram illustrating an example in which a plurality ofMPEG-2 TSs is connected.

Referring to FIG. 2, in the MPEG-2 TS switching methods provided byISO/IEC 1381-1 MPEG-2 systems, MPEG-2 TSs corresponding to respectiveprograms have already been produced as shown in FIG. 2, and the TSs ofthe programs are sequentially connected. Accordingly, as shown in FIG.2, the first of an advertisement 1 TS that will be switched after aprogram 1 TS may have been encoded into an Instantaneous DecodingRefresh (IDR) picture. Accordingly, there is no problem because anin-point will become the IDR picture and the B picture indicated by thedotted lines in the B stream of FIG. 1 is not present.

In the case where a plurality of MPEG-2 TSs continues to be receivedfrom different encoders, however, there is a problem in that a delaytime is too long if switching is performed after an IDR picture isreached at a stream to be switched and entered.

Furthermore, a closed GOP structure may be used to obviate a problem inthat a B picture subsequent to the I picture of a stream to be switchedand entered cannot be decoded. In general, in broadcasting, the video ofa broadcasting program is encoded in an open GOP structure by taking anencoding efficiency viewpoint into consideration. It is however almostimpossible to perform encoding in the closed GOP structure only at apoint where a stream is expected to be replaced because the setting ofan encoder needs to be changed.

Furthermore, two MPEG-2 TSs need to be switched within a short time asmuch as possible without buffering a plurality of received MPEG-2 TSs.To this end, the I picture of a B stream needs to be input at a point oftime at which a P or I picture is started on the basis of a DecodingTime Stamp (DTS) in a stream A.

FIG. 3 is a diagram illustrating an example of an in-point having greatdelay in the switching of an MPEG-2 TS.

From FIG. 3, it may be seen that after an out-point is searched for, itis difficult to disconnect a stream A because an I picture that firstappears in a B stream is input to a P picture of the stream A, and as aresult, switching is performed at the moment when the I picture of the Bstream is input at the same time as the P or I picture of the stream Ais ended. Accordingly, there is a problem in that switching delay timebecomes significantly long.

FIG. 4A illustrates an example of the conventional mixed broadcasting ofHDTV service and 3DTV service, and FIG. 4B illustrates an example of theconventional mixed broadcasting of HDTV service and multi-channelservice.

Referring to FIGS. 4A and 4B, if an HDTV program, a 3D program, and amulti-channel service program are interchangeable with one another andserved in a single channel, a problem may occur when MPEG-2 TSs areswitched.

Accordingly, there is a need to connect two MPEG-2 TSs to two differentMPEG-2 TSs in such a manner that the two MPEG-2 TSs may be restoredwithout a phenomenon in which audio or video is disconnected or brokenat a point of time at which the two MPEG-2 TSs are connected to the twodifferent MPEG-2 TSs.

SUMMARY OF THE INVENTION

An embodiment of the present invention relates to a method of connectingtwo MPEG-2 TSs output by different encoders, and an object of thepresent invention is to provide a method and apparatus for connectingdifferent MPEG-2 TSs in such a manner that the different MPEG-2 TSs canbe restored without a phenomenon in which audio or video is disconnectedor broken at a point of time at which the different MPEG-2 TSs areconnected.

In accordance with an aspect of the present invention, there is provideda method of switching a transport stream, including receiving aplurality of different input streams, receiving a switching command fora first input stream that belongs to the plurality of input streams andthat is now output, searching for the out-point of the first inputstream and the in-point of a second input stream that is newly output,based on the switching command, inserting a virtual P picture streambetween the out-point and the in-point, and performing switching fromthe first input stream into the second input stream based on theout-point and the in-point.

The out-point may be searched for as the start point of the first I or Ppicture of the first input stream after the switching command, and thein-point may be searched for as the start point of the first I pictureof the second input stream after the out-point.

The virtual P picture stream may be inserted by replacing a picturestream of the first input stream from the out-point to the in-point, anda null packet corresponding to the length of the picture stream from theout-point to the in-point may be filled.

The virtual P picture stream may include a stream in which the motioninformation of all the macro blocks and a residual signal are made 0according to an encoding method through the analysis of a video ElementStream (ES) included in the first or the second input stream.

If the P or B picture of the second input stream after the in-point thatrefers to a picture before the in-point is present, the P or B picturemay be replaced with the virtual P picture stream, and a null packetcorresponding to the length of a packet may be inserted.

The Presentation Time Stamp (PTS), Decoding Time Stamp (DTS), and timestamp of a Program Clock Reference (PCR) of the second input streamafter the in-point may be modified so that the PTS, the DTS, and thetime stamp become a PTS, a DTS, and a time stamp of a PCR that arecontinuous based on the time information of the first input stream.

If the second input stream is a stream of a 3D left image, in switchingfrom the second input stream to a right-image video stream correspondingto the 3D left image, when the switching is performed based on thein-point of the second input stream, the PTS of a picture correspondingto the in-point of the second input stream may be stored, the PTS andDTS of the right-image video stream may be modified based on the storedPTS, and the PCR of the right-image video stream may be modified basedon the PCR of the first input stream.

The method may further include counting a first frame count value thatis the number of frames of the first input stream and a second framecount value that is the number of frames of the second input streamuntil a switching command for the second switching is input after thefirst switching when the second switching from the second input streamto the first input stream is performed after the first switching fromthe first input stream to the second input stream, comparing the firstframe count value with the second frame count value, and performing thesecond switching based on a result of the comparison.

If, as a result of the comparison, the second frame count value is equalto or greater than the first frame count value, the null packet may beinserted between the out-point of the second input stream and thein-point of the first input stream by the length of a packetcorresponding to the number of frames obtained by subtracting the secondframe count value from the first frame count value when performing thesecond switching.

A picture stream up to the in-point of the first input stream after theinserted null packet may be replaced with the virtual P picture stream,and the length of the packet may be set using the null packet.

If, as a result of the comparison, the first frame count value isgreater than the second frame count value, the virtual P picture streammay be inserted between the out-point of the second input stream and thein-point of the first input stream by the number of packetscorresponding to the number of frames obtained by subtracting the firstframe count value from the second frame count value when performing thesecond switching, the first frame count and the second frame count maycontinue to be performed while inserting and outputting the virtual Ppicture stream, and a virtual P picture stream may be additionallyinserted until the first frame count becomes equal to the second framecount.

The switching of an audio signal from the first input stream to thesecond input stream may be performed by storing the PTS of a picture atwhich video is switched and using a point of time at which the PTS ofsubsequently input audio corresponds to a PTS at which a picture of thevideo is switched as a switching time point.

Different ring buffers for the first input stream and the second inputstream may be configured, time information about each frame included inan audio Packetized Elementary Stream (PES) may be calculated based ontime information included in the PES, and the calculated timeinformation may be stored.

In accordance with an aspect of the present invention, there is providedan apparatus of switching a transport stream, including an input streamreception unit configured to receive a plurality of different inputstreams, a switching command input unit configured to receive aswitching command for a first input stream that belongs to the pluralityof input streams and that is now output, a search unit configured tosearch for the out-point of the first input stream and the in-point of asecond input stream that is newly output, based on the switchingcommand, an insertion unit configured to insert a virtual P picturestream between the out-point and the in-point, and a switching executionunit configured to perform switching from the first input stream intothe second input stream based on the out-point and the in-point.

The insertion unit may be further configured to insert the virtual Ppicture stream by replacing a picture stream of the first input streamfrom the out-point to the in-point with the virtual P picture stream andfill a null packet corresponding to the length of the picture streamfrom the out-point to the in-point is filled.

The virtual P picture stream may include a stream in which motioninformation of all the macro blocks and a residual signal are made 0according to an encoding method through an analysis of a video ElementStream (ES) included in the first or the second input stream.

The apparatus may further include a frame counter configured to count afirst frame count value that is the number of frames of the first inputstream and a second frame count value that is the number of frames ofthe second input stream until a switching command for second switchingis input after first switching when the second switching from the secondinput stream to the first input stream is performed after the firstswitching from the first input stream to the second input stream,compare the first frame count value with the second frame count value,and perform the second switching based on a result of the comparison.

If, as a result of the comparison, the second frame count value is equalto or greater than the first frame count value, the null packet may beinserted between the out-point of the second input stream and thein-point of the first input stream by the length of a packetcorresponding to the number of frames that is obtained by subtractingthe second frame count value from the first frame count value whenperforming the second switching.

If, as a result of the comparison, the first frame count value isgreater than the second frame count value, the virtual P picture streammay be inserted between the out-point of the second input stream and thein-point of the first input stream by the number of packetscorresponding to the number of frames obtained by subtracting the firstframe count value from the second frame count value when performing thesecond switching, the first frame count and the second frame count maycontinue to be performed while inserting and outputting the virtual Ppicture stream, and a virtual P picture stream may be additionallyinserted until the first frame count becomes equal to the second framecount.

In accordance with an aspect of the present invention, there is a systemfor switching a transport stream, including a plurality of encodersconfigured to generate a plurality of encoded input streams and send theplurality of encoded input streams and a transport stream switching unitconfigured to receive the plurality of input streams from the pluralityof encoders and perform switching into a specific input stream, Thetransport stream switching unit may receive a switching command for afirst input stream that belongs to the plurality of input streams andthat is now output, search for the out-point of the first input streamand the in-point of a second input stream that is newly output, inresponse to the switching command, insert a virtual P picture streambetween the out-point of the first input stream and the in-point of thesecond input stream, and perform switching from the first input streaminto the second input stream based on the out-point and the in-point.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a diagram illustrating an example of an in-point and out-pointfor the switching of an MPEG-2 TS;

FIG. 2 is a diagram illustrating an example in which a plurality ofMPEG-2 TSs is connected;

FIG. 3 is a diagram illustrating an example of an in-point having greatdelay in the switching of an MPEG-2 TS;

FIG. 4A illustrates an example of the conventional mixed broadcasting ofHDTV service and 3DTV service;

FIG. 4B illustrates an example of the conventional mixed broadcasting ofHDTV service and multi-channel service;

FIG. 5 is a diagram illustrating the input/output forms of an MPEG-2 TSswitching unit for broadcasting service support in which 3DTV isinterchangeable with HDTV in a single channel according to an embodimentof the present invention;

FIG. 6 is a flowchart schematically illustrating a method of switching atransport stream according to an embodiment of the present invention;

FIG. 7 is a conceptual diagram illustrating the configuration of videostreams when switching is performed from a first input stream to asecond input stream in the method of switching a transport streamaccording to an embodiment of the present invention;

FIG. 8 is a conceptual diagram illustrating an example of a change ofthe PTS of a video Element Stream (ES) in a second input stream that hasbeen switched and input in the method of switching a transport streamaccording to an embodiment of the present invention;

FIG. 9 is a flowchart illustrating a switching method according to thecounted values of frames of first and second input streams in the methodof switching a transport stream according to another embodiment of thepresent invention;

FIG. 10 is a conceptual diagram illustrating an example in which thecount number of frames of a second stream is greater than the countnumber of frames of a first stream at an out-point in switching from thesecond input stream to the first input stream in the method of switchinga transport stream according to another embodiment of the presentinvention;

FIG. 11 is a conceptual diagram illustrating an example in which PTSvalues are generated when the count number of frames of a second streamis greater than the count number of frames of a first stream at anout-point in switching from the second input stream to the first inputstream in the method of switching a transport stream according toanother embodiment of the present invention;

FIG. 12 is a conceptual diagram illustrating an example in which thecount number of frames of a first stream is greater than the countnumber of frames of a second stream at an out-point in switching fromthe second input stream to the first input stream in the method ofswitching a transport stream according to yet another embodiment of thepresent invention;

FIG. 13 is a conceptual diagram illustrating an example in which PTSvalues are generated when the count number of frames of a first streamis greater than the count number of frames of a second stream at anout-point in switching from the second input stream to the first inputstream in the method of switching a transport stream according to yetanother embodiment of the present invention;

FIG. 14 is a conceptual diagram illustrating an example in which thetime information of an audio frame is calculated and stored in a ringbuffer in the method of switching a transport stream according to anembodiment of the present invention;

FIG. 15 is a conceptual diagram illustrating an example of the switchingof an audio stream in the method of switching a transport streamaccording to an embodiment of the present invention; and

FIG. 16 is a block diagram illustrating a TS switching apparatusaccording to an embodiment of the present invention.

DETAILED DESCRIPTION OF THE EMBODIMENTS

The present invention may be modified in various ways and may beimplemented to have several embodiments. Specific embodiments areillustrated in the drawings and are described in detail.

It is however to be understood that the present invention is notintended to be limited to the specific embodiments, but that thespecific embodiments include all modifications, equivalents, andsubstitutions which fall within the spirit and technical scope of thepresent invention.

Terms, such as the first and the second, may be used to describe variouselements, but the elements should not be restricted by the terms. Theterms are used to only distinguish one element and the other elementfrom each other. For example, a first element may be named a secondelement without departing from the scope of the present invention.Likewise, a second element may be named a first element. A term “and/or”includes a combination of a plurality of related and described items orany one of a plurality of related and described items.

When it is said that one element is “connected” or “coupled” with theother element, it should be understood that one element may be directlyconnected or coupled with the other element, but a third element mayexist between the two elements. In contrast, when it is said that oneelement is “directly connected” or “directly coupled” with the otherelement, it should be understood that a third element does not existbetween the two elements.

The terms used in this application are used to only describe specificembodiments and are not intended to restrict the present invention. Anexpression of the singular number includes an expression of the pluralnumber unless clearly defined otherwise in the context. In thisapplication, terms, such as “comprise” or “have”, are intended todesignate that characteristics, numbers, steps, operations, elements, orparts which are described in the specification, or a combination of themexist, and should not be understood that they exclude the existence orpossible addition of one or more other characteristics, numbers, steps,operations, elements, parts, or combinations of them in advance.

All terms used herein, unless otherwise defined, have the same meaningsas those typically understood by those having ordinary skill in the art.The terms, such as ones defined in common dictionaries, should beinterpreted to have the same meanings as terms in the context ofpertinent technology, and should not be interpreted to have ideal orexcessively formal meanings unless clearly defined in the specification.

Hereinafter, some exemplary embodiments of the present invention aredescribed in more detail with reference to the accompanying drawings. Indescribing the present invention, in order to help generalunderstanding, the same reference numerals are used to denote the sameelements throughout the drawings, and a redundant description of thesame elements is omitted.

Broadcasting Service Environment in which 3DTV is Interchangeable withHDTV

Today, in the case of terrestrial wave DTV, a single broadcastingprogram is transmitted through a single channel. If service-compatible3DTV service or Multi-Mode Service (MMS) by which a plurality ofprograms is served through a single channel is introduced, however, timeduring which a single HDTV program is served and mixed broadcasting inwhich a plurality of programs, such as a 3DTV program or an MMS program,is served may be present in a single channel depending on a broadcastingprogram, as illustrated in FIGS. 4A and 4B.

A service-compatible 3DTV method is a 3DTV method for encoding andsending the streams of left and right images, and has compatibility withexisting HDTV broadcasting service. A user who owns existing HDTV mayreceive only signals that belong to 3DTV signals and that are encoded byan MPEG-2 encoder, and may view HDTV broadcasting. Likewise, even in amulti-channel service method, a user who owns existing HDTV may view oneof a plurality of programs provided by existing HDTV 1.

In contrast, if a user has 3DTV or TV or a terminal capable of MMSviewing, the user may select and view 3DTV and a desired one of aplurality of programs. In this case, a broadcasting company has toswitch the program from a single HDTV program to a 3DTV program or anMMS program or from a 3DTV program or an MMS program to a single HDTVprogram and to send corresponding MPEG-2 TSs. In such a case, aphenomenon in which audio is disconnected video is broken should notoccur because an existing HDTV user continuously views only single HDTVbroadcasting although the transmitted MPEG-2 TSs are output by differentencoders.

FIG. 5 is a diagram illustrating the input/output forms of an MPEG-2 TSswitching unit for broadcasting service support in which 3DTV isinterchangeable with HDTV in a single channel according to an embodimentof the present invention.

Referring to FIG. 5, regarding, an MPEG-2 encoder 510 encodes the signal502 of a single HDTV program, and a 3DTV encoder 520 encodes the HDTV(left image) signal 502 and right-image signal 504 of a 3DTV program. Ingeneral, in a broadcasting company, the two encoders 510 and 520continue to operate around the clock regardless of whether a program isan HDTV or 3DTV program for stability purposes. Accordingly, the HDTVencoder 510, the 3DTV encoder 520, and an MPEG-2 TS switching unit 530continue to normally operate regardless of the type of program. If aprogram is an HDTV program, the 3DTV encoder 520 may encode only theleft image 502, and the right image 504 may output null data. The MPEG-2TS switching unit 530 for mixed broadcasting support basically outputsTSs received from the MPEG-2 encoder 510. When a 3DTV program isstarted, the MPEG-2 TS switching unit 530 switches into TSs receivedfrom the 3DTV encoder 520 and outputs the TSs. In this case, the TSsoutput by the 3DTV encoder 520 includes an HDTV program. When the 3DTVprogram is received, a viewer who owns HDTV receives, decodes, ad viewsonly an HDTV signal in an MPEG-2 TS output by the 3DTV encoder 520. Inthis case, it is important that the video and audio of HDTV are notbroken. Likewise, a viewer who owns 3DTV continues to receive and decodeonly HDTV signal. When information called the 3DTV program is received,the viewer determines whether or not to view HDTV or to change HDTV into3DTV and view 3DTV depending on his or her preference. Accordingly, aphenomenon in which the video and audio of the HDTV (left image) 502 arebroken should not occur. When a user selects 3DTV watching mode, theright image 504 is decoded. Accordingly, broadcasting is started fromthe beginning without a connected part. For this reason, when the MPEG-2TS switching unit 530 switches an HDTV program TS into a 3DTV programTS, the MPEG-2 TS switching unit 530 searches the left image 502 TSwithin the HDTV program TS and the 3DTV program TS for an out-point andan in-point. When the in-point of the left image 502 TS is determinedand switched, the right image 504 TS performs switching processing onthe right image 504 TS based on the in-point of the left image 502 TS.In this specification, the TS has been illustrated as being an MPEG-2TS, but may be another TS, for example, an MPEG Media Transport (MMT)stream. Furthermore, a switched service signal is not necessarilylimited to only an HDTV and 3DTV signal, but may be applied to theswitching of a specific service method having a different encodingmethod. If switching is necessarily required because encoding parametersare different although the same encoding method is used, a switchingmethod according to an embodiment of the present invention may be used.

Transport Stream Switching Method

FIG. 6 is a flowchart schematically illustrating a method of switching atransport stream according to an embodiment of the present invention.

Referring to FIG. 6, first, a TS switching apparatus (not shown)receives a plurality of different input streams at step S610. Thedifferent input streams are streams that need to be switched, and may bestreams having different encoding methods. The different input streamsmay be streams received from different encoders. When the plurality ofinput streams is received, the apparatus may monitor whether a switchingcommand is present or not at step S620. The switching command may beautomatically or manually received. For example, a user who wantsswitching may input the switching command using a user interface (notshown), or the switching command may be automatically received throughuser setting. When the switching command is automatically received, timemay be set so that the switching command is periodically received. If,as a result of the monitoring, a switching command is found to bepresent, the apparatus searches for an out-point and an in-point at stepS630. As described above, the out-point and the in-point may be searchedfor based on a point of time at which a specific picture appears in afirst input stream and a second input stream (the first input stream isa stream whose output is terminated by switching, and the second inputstream is a stream that is newly output by the switching). That is, theout-point may be searched for based on the first input stream, and thein-point may be searched for based on the second input stream from thelocation of the out-point. In accordance with an embodiment of thepresent invention, as in a conventional method, the out-point andin-point of the first and the second input streams that are related tothe switching may be searched for by taking into consideration only theabsolute relation between the first input stream and the second inputstream. That is, the out-point and the in-point are pushed backward inaccordance to a relative relation, thereby being capable of preventingthe delay of a switching time from occurring.

After the out-point and the in-point are searched for as describedabove, the apparatus inserts a virtual P picture Element Stream (ES) anda null packet between the out-point and the in-point at step S640. Inaccordance with an embodiment of the present invention, the virtual Ppicture ES is a stream in which the motion information of all macroblocks is 0 and a residual signal becomes 0 according to a videoencoding method, such as MPEG-2, Advanced Video Coding (AVC), or HighEfficiency Video Coding (HEVC) through the analysis of a video ESincluded in a received TS. The virtual P picture ES may be previouslygenerated and stored in memory. Any one of the in-point search processand the process of inserting the virtual P picture and the null packetmay be first performed according to circumstances. That is, aftersearching for the out-point, the virtual P picture and the null packetmay be inserted until the in-point appears, a picture stream suitablefor in-point conditions may be searched for, and the insertion of thevirtual P picture and the null packet may be then terminated.Alternatively, after searching for the out-point, the in-point may bescanned in advance, and the virtual P picture and the null packet may bethen inserted between the retrieved in-point and the scanned out-point.The null packet functions to set the length of a packet by performingfilling by the length of a P or B picture stream from the out-point ofthe first input stream to the in-point of the second input stream.

After inserting the virtual P picture ES and the null packet, theapparatus performs switching into the second input stream at thein-point at step S650.

FIG. 7 is a conceptual diagram illustrating the configuration of videostreams when switching is performed from a first input stream to asecond input stream in the method of switching a transport streamaccording to an embodiment of the present invention.

Referring to FIG. 7, when a TS switching apparatus (e.g., the MPEG-2 TSswitching unit) is powered on, the apparatus may receive a first inputstream 710 and a second input stream 720. In this case, according to anembodiment corresponding to the aforementioned example, the first inputstream 710 may be an HDTV TS, and the second input stream 720 may be a3DTV TS (refer to FIG. 5). In such a case, the HDTV TS is automaticallyoutput as the first input stream 710. In this case, a 3DTV program isstarted, and a user who tries to switch into the second input stream 720(i.e., the 3DTV TS) may issue a switching command 702. As describedabove, the switching command 702 may be automatically or manually input.When the switching command 702 is input, the apparatus searches thevideo of the first input stream 710 for an out-point 712, and performsreplacement and insertion on a virtual P picture ES 732 until anin-point 714 appears based on a left image video within the second inputstream 720 (i.e., the 3DTV TS) from the location of the out-point 712.Furthermore, the apparatus sets the length of a packet by performingfilling using a null packet by the length of a P or B picture streamfrom the out-point 712 to the in-point 714 in the video stream of thefirst input stream 710.

Referring to an output stream 730, the apparatus replaces the P or Bpicture part of the first input stream 710 with the virtual P picture ES732 according to the first input stream 710 in the stream section 732.The virtual P picture ES 732 is a stream in which the motion informationof all macro blocks is 0 and the residual signal has been made to become0. Accordingly, the start location of an I picture may be easily filledwith a null packet at the first in-point 714 after the out-point 712even without buffering an input TS because the amount of data of thevirtual P picture ES 732 is much smaller than an actual video pictureES.

In accordance with an embodiment of the present invention, two Bpictures 716 indicated by dotted lines after the in-point 714 arereplaced with a virtual P picture ES 736, thereby preventing aphenomenon in which video is broken although separate two TSs areconnected. The two B pictures 716 indicated by the dotted lines arepictures that refer to a picture before the in-point of the second inputstream 714, and video may be broken because the referred picture ispresent prior to switching and thus a picture to be referred to is notpresent. In this case, a phenomenon in which video is broken may beprevented by replacing the two B pictures 716 with the virtual P pictureES 736. If two videos correspond streams encoded using differentencoding methods, the virtual P picture ES 732 from the out-point 712 tothe in-point 714 and the virtual P picture ES 736 after the in-point 714may have different forms of ESs from a viewpoint of the output stream730.

In accordance with an embodiment of the present invention, the virtual Ppicture ES 732 from the out-point 712 to the in-point 714 and thevirtual P picture ES 736 after the in-point 714 become the same virtualP picture ES because video within the first input stream 710 (i.e., theHDTV TS) uses an MPEG-2 encoder and likewise a left image video withinthe second input stream 720 (i.e., the 3DTV TS) uses an MPEG-2 encoder.

FIG. 8 is a conceptual diagram illustrating an example of a change ofthe PTS of a video ES in a second input stream that has been switchedand input in the method of switching a transport stream according to anembodiment of the present invention.

Referring to FIG. 8, in an ES output as in FIG. 7, the Presentation TimeStamp (PTS), the Decoding Time Stamp (DTS), and the time stamp of aProgram Clock Reference (PCR) of a left-image video ES within a secondinput stream 820 (e.g., a 3DTV TS) that has been switched need to bemodified. The time stamp is modified so that it becomes the PTS, theDTS, and the time stamp of the PCR that are continuous based on the timeinformation of an HDTV MPEG-2 TS, that is, the first input stream 810.In this case, the DTS and the PCR may be processed based on the PTS.

In accordance with another embodiment of the present invention, inswitching from an HDTV TS into a 3DTV TS, the switching of a right-imagevideo ES within the 3DTV TS is performed based on a left-image video ES.That is, an in-point may be searched for based on the left-image videoES within the 3DTV TS, and the PTS of video at which switching isstarted may be stored. Thereafter, when the right-image video ES withinthe input 3DTV MPEG-2 TS appears, a PTS and a DTS may be modified basedon the stored PTS, and a PCR may be modified based on the PCR of thefirst input stream 810.

Procedure for Processing Re-Switching Command

FIG. 9 is a flowchart illustrating a switching method according to thecounted values of frames of first and second input streams in the methodof switching a transport stream according to another embodiment of thepresent invention.

Referring to FIG. 9, after performing first switching from a first inputstream to a second input stream at step S910, the TS switching apparatus(not shown) counts the number of frames of first and second inputstreams at step S920. The counting of the number of frames of first andsecond input streams does not need to be necessarily performed after thefirst switching, but may be performed in such a manner that the numberof frames of the first and the second input frames is set based on aswitching time point in the state in which a frame counter (not shown)already counts the number of frames. Thereafter, the apparatus receivesa second switching command for switching the second input stream intothe first input stream at step S930. For example, the second switchingcommand may include a switching command for switching a 3DTV TS into anHDTV TS while the 3DTV TS is output in the state in which the HDTV TShas been switched into the 3DTV TS. In this case, the apparatus comparesthe count value of the second input frame with the count value of thefirst input frame until the switching command is received after thefirst switching at step S940. In this case, a process for secondswitching may be differently performed based on a result of thecomparison.

If, as a result of the comparison, the count value of the second inputframe is equal to or greater than the count value of the first inputframe, the apparatus inserts a null packet by the length of a packet ofthe number of frames that corresponds to the difference between thesecond input frame and the first input frame at step S950. Thereafter,picture streams from the inserted null packet to the in-point of thefirst input stream may be replaced with a virtual P picture ES at stepS960. As in the aforementioned embodiment, after the picture streams arereplaced with the virtual P picture ES, a null packet is inserted inorder to set the length of the packet at step S970. Thereafter, thesecond switching is performed at the in-point of the first input streamat step S980.

In contrast, if, as a result of the comparison at step S940, the countvalue of the first input frame is greater than the count value of thesecond input frame, a virtual P picture ES is inserted by the number ofpackets corresponding to the difference between the count value of thefirst input frame and the count value of the second input frame at stepS955. Thereafter, the number of frames of the first and the second inputstreams continues to be counted after the first switching at the momentwhen the virtual P picture ES is inserted, and a virtual P picture ES isadditionally inserted until the number of frames of the first inputstream becomes equal to the number of frames of the second input streamat step S965. When the number of frames of the first input streambecomes equal to the number of frames of the second input stream, theprocess is terminated, and the second switching is performed at thein-point of the first input stream at step S980.

FIG. 10 is a conceptual diagram illustrating an example in which thecount number of frames of a second stream is greater than the countnumber of frames of a first stream at an out-point in switching from thesecond input stream to the first input stream in the method of switchinga transport stream according to another embodiment of the presentinvention.

Referring to FIG. 10, a first input stream 1010 (e.g., an HDTV TS) isswitched into a second input stream 1020 (e.g., a 3DTV TS), and thesecond input stream 1020 (e.g., the 3DTV TS) is output. If a 3DTVprogram is terminated and the second input stream 1020 (e.g., the 3DTVTS) is switched into the first input stream 1010 (e.g., the HDTV TS)again, the apparatus continues to count the number of video frames ofthe first input stream 1010 that is received after the first inputstream 1010 is switched into the second input stream 1020 and the numberof video frames (e.g., the number of left-image video frames) output bythe second input stream 1020 in order to prevent a problem in video andaudio signals. The number of frames of the first input stream 1010(e.g., the HDTV TS) is called “Frame_Count_(—)1”, and the number offrames of the second input stream 1010 (e.g., the 3DTV TS) is called“Frame_Count_(—)2”. When a switching command 1002 for switching thesecond input stream 1020 into the first input stream 1010 is received,the apparatus searches for an out-point 1012 and an in-point 1014 asdescribed above. A TS switching processing method is divided into twotypes depending on which one of Frame_Count_(—)1 and Frame_Count_(—)2 atthe out-point 1012 is great.

First, if Frame_Count_(—)2 is greater than Frame_Count_(—)1 at theout-point 1012, a null packet 1032 is filled by the length of a packetcorresponding to the number of frames obtained by subtractingFrame_Count_(—)2 from Frame_Count_(—)1. The embodiment of FIG. 10illustrates that Frame_Count_(—)1−Frame_Count_(—)2 is 2 at the out-point1012. The null packet 1032 is filled by the length of a packetcorresponding to a P picture and a B picture indicated by dotted line inthe video ES within the first input stream 1010 (e.g., the HDTV TS).Four picture ESs 1034 up to the in-point 1014 after the B pictureindicated by the dotted line are portions corresponding to the firstinput stream 1010, and are replaced with virtual P pictures ES. Asdescribed above, the length of the packet is set using the null packet.

FIG. 11 is a conceptual diagram illustrating an example in which PTSvalues are generated when the count number of frames of a second streamis greater than the count number of frames of a first stream at anout-point in switching from the second input stream to the first inputstream in the method of switching a transport stream according toanother embodiment of the present invention.

Referring to FIG. 11, likewise, the values of a PTS, a DTS, and the timestamp of a PCR need to be changed. If a second input stream 1120 (e.g.,a 3DTV TS) is switched into a first input stream 1110 (e.g., an HDTVTS), the values of the time stamps of virtual P picture ESs have only tobe generated and set as shown in FIG. 11. An in-point 1114 in the firstinput stream 1110 (e.g., the HDTV TS) that is switched again and inputhas only to be connected using an I picture without a change of timestamps (i.e., connection using a time stamp “65” in FIG. 11).

FIG. 12 is a conceptual diagram illustrating an example in which thecount number of frames of a first stream is greater than the countnumber of frames of a second stream at an out-point in switching fromthe second input stream to the first input stream in the method ofswitching a transport stream according to yet another embodiment of thepresent invention.

FIG. 12 illustrates the case where Frame_Count_(—)2 at the out-point1212 of a second input stream 1220 is smaller than Frame_Count_(—)1. Insuch a case, virtual P picture ESs 1232 corresponding to the number offrames obtained by subtracting Frame_Count_(—)2 from Frame_Count_(—)1are inserted. The video frames of a first input stream 1210 (e.g., anHDTV TS) continue to be received while the virtual P picture ESs 1232are inserted and output. Accordingly, the number of video frames of thefirst input stream 1210 (e.g., the HDTV TS) continues to be counted, andthe virtual P picture ESs 1232 are inserted until Frame_Count_(—)2becomes equal to Frame_Count_(—)1 by continuously increasingFrame_Count_(—)2 to the extent that the virtual P picture ESs 1232 areinserted. The embodiment of FIG. 12 illustrates the case whereFrame_Count_(—)1−Frame_Count_(—)2=6 frames at the out-point 1212. Theembodiment of FIG. 12 illustrates the case where when a total of 8virtual P picture ESs are inserted by additionally inserting 2 virtual Ppicture ESs 1234, the location of a packet at which a specific frame ofthe first input stream 1210 (e.g., the HDTV TS) is started. Furthermore,as in the aforementioned embodiment, with respect to three picturesahead of the in-point 1214, the length of the packet is set usingvirtual P picture ESs and a null packet.

FIG. 13 is a conceptual diagram illustrating an example in which PTSvalues are generated when the count number of frames of a first streamis greater than the count number of frames of a second stream at anout-point in switching from the second input stream to the first inputstream in the method of switching a transport stream according to yetanother embodiment of the present invention.

Referring to FIG. 13, likewise, the values of a PTS, a DTS, and the timestamp of a PCR need to be changed. If a second input stream 1320 (e.g.,a 3DTV TS) is switched into a first input stream 1310 (e.g., an HDTVTS), only the values of the time stamps of an inserted virtual P pictureES 1332 have only to be newly generated and set as shown in FIG. 13. Anin-point 1314 in the first input stream 1310 (e.g., the HDTV TS) that isswitched again and input has only to be connected using an I picturewithout a change of time stamps (connected using a time stamp ‘65’ inFIG. 13).

Processing of Audio Frame

In general, since a synchronization signal is searched for based on anaudio signal, the audio signal is transmitter posterior to a videosignal. Accordingly, the PTS of a picture at which video is switched isstored, and a point of time at which the PTS of audio that is laterreceived corresponds to a PTS at which video picture is switched is usedas a switching time point.

FIG. 14 is a conceptual diagram illustrating an example in which thetime information of an audio frame is calculated and stored in a ringbuffer in the method of switching a transport stream according to anembodiment of the present invention.

Referring to FIG. 14, a video stream is switched according to each PESbecause the ES of a single frame includes a single PES. In contrast, inthe case of an audio stream, since the ES of a plurality of frames isincluded in a single PES, there is a problem in that an AC-3 decoder maynot properly decode an audio signal and all streams may be seriouslyaffected if the audio stream is switched according to each PES. Thereason for this is that most of decoders perform processing based on theaudio signal. Accordingly, switching processing needs to be performed onaudio according to each ES included in a PES. However, time informationis present according to each PES. Accordingly, in an embodiment of thepresent invention, as shown in FIG. 14, different ring buffers 1430 and1432 may be configured with respect to two input streams, that is, firstand second input stream audio PESs 1410 and 1420, time information abouteach frame included in an audio PES may be calculated based on timeinformation included in the audio PES, and the calculated timeinformation may be stored. That is, an AC3 frame, that is, each of ESswithin the audio PES 1410 of the first input stream, may be stored inthe ring buffer #1 1430 along with the time information of a PTS. An AC3frame, that is, each of ESs within the audio PES 1420 of the secondinput stream, may be separately stored in the ring buffer #2 1432 alongwith the time information of the PTS. Accordingly, although switching isperformed in the middle of the audio PES of an input stream, an EScorresponding to a switching time point may be searched for, and supportmay be provided so that switching is performed in a corresponding AC3frame.

FIG. 15 is a conceptual diagram illustrating an example of the switchingof an audio stream in the method of switching a transport streamaccording to an embodiment of the present invention.

Referring to FIG. 15, in switching from a first input stream audio PES1510 to a second input stream audio PES, a calculative switching timepoint is calculated based on the PTS of a corresponding PES using a ringbuffer #2 1532 in which the time information of each ES of the secondinput stream audio PES and the ES data of the second input stream audioPES are stored. Thereafter, control is performed so that switching intothe second input stream audio PES is performed in the AC3 frame 1542 ofthe second input stream audio PES corresponding to the calculatedswitching time point.

Other Utilization

The method of switching a transport stream according to an embodiment ofthe present invention may be applied to mutual switching between twodifferent HDTV TSs and mutual switching between TSs for multi-channelservice in an HDTV TS in addition to switching from an HDTV TS to a 3DTVTS.

Furthermore, the MPEG-2 TS switching unit according to an embodiment ofthe present invention has a function of generating Program SpecificInformation (PSI) suitable for service depending on whether switchingbetween what MPEG-2 TSs will be performed.

TS Switching Apparatus

FIG. 16 is a block diagram illustrating a TS switching apparatusaccording to an embodiment of the present invention. As shown in FIG.16, the TS switching apparatus 1600 according to an embodiment of thepresent invention may include a reception unit 1610, a switching commandinput unit 1620, a control unit 1630, a storage unit 1640, a framecounter 1650, and an output unit 1660.

Referring to FIG. 16, the reception unit 1610 receives a plurality ofdifferent input streams. The received input streams may be streamsreceived from different encoders. Methods of encoding the received inputstreams may be the same or may be different. The reception unit 1610receives the input streams through wired or wireless communication.

The switching command input unit 1620 manually or automatically inputs aswitching command. If the switching command is manually input, theswitching command may be input through a user interface (not shown) froma user who wants to input the switching command. If the switchingcommand is automatically input, the switching command may be inputdepending on set input conditions. The input conditions may be set basedon time. In this case, the switching command may be periodically inputin a specific time period, or a scheduling time may be set and theswitching command for automatically switching a channel 1 into a channel2 may be input at a specific point of time. In addition to time, channelconditions, network conditions, etc. may be set, and the switchingcommand may be automatically input depending on network conditions(e.g., an available bandwidth and a packet loss ratio).

The control unit 1630 controls the execution of switching betweenreceived input streams in response to the input of a switching command.The control unit 1630 may include a search unit 1631, an insertion unit1632, a switching execution unit 1633, a video analysis unit 1634, atime stamp modification unit 1635, a count value comparison unit 1636,and an audio time control unit 1637.

When a switching command is received, the search unit 1631 searches forthe out-point of a first input stream whose output is terminated byswitching and the in-point of a second input stream that is newly outputby the switching. The out-point may be searched for as the start pointof the first I or P picture after the switching command is received, andthe in-point may be searched for as the start point of the first Ipicture after the out-point.

The insertion unit 1632 inserts a virtual P picture ES and a null packetbetween the out-point and the in-point. The insertion unit 1632 mayreceive the virtual P picture ES from a virtual P picture storage unit1642, and may insert the received virtual P picture ES between theout-point and the in-point. The insertion unit 1632 may replace apicture that belongs to a P or B picture after the in-point and thatrefers to video before the in-point, and may insert the virtual Ppicture ES. In this case, in the case of the P or B picture, a virtual Ppicture based on the encoding method of a second input stream isreceived from the virtual P picture storage unit 1642, and is inserted.

The switching execution unit 1633 performs switching between inputstreams at an in-point.

The video analysis unit 1634 may analyze the video ES of an input streamreceived from the reception unit 1610, may generate a virtual P pictureES, and may store the generated virtual P picture ES in the virtual Ppicture storage unit 1642. If methods of encoding first and second inputstreams are different, the video analysis unit 1634 may generate andstore different virtual P picture ESs.

The time stamp modification unit 1635 receives information about thePTS, DTS, and PCR of each input stream from a time stamp (not shown),and modifies the information about the PTS, the DTS, and the PCRsuitably for switching between input streams. For example, the timestamp modification unit 1635 may modify information about the PTS, DTS,and PCR of a second input stream so that the PTS, the DTS, and the PCRbecome a PTS, a DTS and the time stamp of a PCR that are continuousbased on the time information of a first input stream.

When second switching (re-switching) from a second input stream to afirst input stream is performed again after first switching from thefirst input stream into the second input stream, the count valuecomparison unit 1636 receives the value of the number of frames of thefirst input stream and the value of the number of frames of the secondinput stream, counted based on a first switching time point, from theframe counter 1650, and compares the count value of the number of framesof the first input stream with the counted value of the number of framesof the second input stream. A method of inserting, by the insertion unit1632, a virtual P picture ES and a null packet may differ based on aresult of the comparison of the count value comparison unit 1636. Forexample, if the frame count value of the second input stream is equal toor greater than the frame count value of the first input stream, a nullpacket may be inserted by the length of a packet that corresponds to thenumber of frames corresponding to the difference between the two framecount values, picture streams up to the in-point of the first inputstream may be replaced with virtual P picture ESs, and the length of apacket may be set using a null packet. In contrast, if the frame countvalue of the first input stream is greater than the frame count value ofthe second input stream, virtual P picture ESs may be continuouslyinserted by the number of packets corresponding to the differencebetween the two frame count values, the number of frames of the twoinput streams may continue to be counted while the virtual P picture ESsare inserted, and virtual P picture ESs may be further inserted untilthe two frame count values become equal.

The audio time control unit 1637 separately stores the ESs and pieces oftime information of the audio PESs of different input streams that arestored in different ring buffers (e.g., a ring buffer 1 and a ringbuffer 2) within the audio buffer 1646 of the storage unit 1640. Theaudio time control unit 1637 stores the PTS of a picture at which videois switched, compares the stored PTS of the picture with the PTS ofaudio that is later received, and determines a point of time,corresponding to the stored PTS, to be a switching time point.Thereafter, the audio time control unit 1637 performs control so thatswitching is performed in the ES (e.g., an AC3 frame) of a second inputstream corresponding to the determined switching time point.

The storage unit 1640 may include the virtual P picture storage unit1642 configured to store at least one virtual P picture ES generated bythe video analysis unit 1634, a video buffer 1644 configured totemporarily store video streams, and the audio buffer 1646.

The frame counter 1650 counts the number of frames of a received inputframe.

The output unit 1660 outputs streams on which switching has beenperformed. The output unit 1660 may display an image of an input streamon which switching has been performed after the image is decoded by adecoder (not shown). Alternatively, the output unit 1660 may send imagedata to another output device according to circumstances.

In accordance with the method, apparatus, and system for switching atransport stream according to embodiments of the present invention,there is an advantage in that audio and video can be restored without aphenomenon in which the audio is disconnected or the video is broken ata point of time at which two different MPEG-2 TSs output by differentencoders in an open GOP structure are connected when connecting the twoMPEG-2 TSs. Furthermore, there is an advantage in that switching can beperformed within a short time as much as possible from a point of timeat which a switching command is received from a user without bufferingtwo input TSs. Accordingly, the present invention is a technology thatis necessarily required for broadcasting service in which HDTV and 3DTVor multi-channel service are interchangeably used in a single channel.

Furthermore, in accordance with the method, apparatus, and system forswitching a transport stream according to embodiments of the presentinvention, since the processing time taken for input to and output fromthe MPEG-2 TS switching unit is minimized, the delay of a broadcastingprogram is reduced, and thus an input TS can be immediately processedwithout storing the TS in a buffer.

The present invention has been described with reference to theaccompanying drawings and some embodiments, but the scope of the presentinvention should not be construed as being limited to the drawings orthe embodiments. It is to be understood that those skilled in the artmay modify and change the present invention in various ways withoutdeparting from the spirit and scope of the present invention written inthe claims.

What is claimed is:
 1. A method of switching a transport stream,comprising: receiving a plurality of different input streams; receivinga switching command for a first input stream that belongs to theplurality of input streams and that is now output; searching for anout-point of the first input stream and an in-point of a second inputstream that is newly output, based on the switching command; inserting avirtual P picture stream between the out-point and the in-point; andperforming switching from the first input stream into the second inputstream based on the out-point and the in-point.
 2. The method of claim1, wherein: the out-point is searched for as a start point of a first Ior P picture of the first input stream after the switching command, andthe in-point is searched for as a start point of a first I picture ofthe second input stream after the out-point.
 3. The method of claim 1,wherein: the virtual P picture stream is inserted by replacing a picturestream of the first input stream from the out-point to the in-point, anda null packet corresponding to a length of the picture stream from theout-point to the in-point is filled.
 4. The method of claim 1, whereinthe virtual P picture stream comprises a stream in which motioninformation of all the macro blocks and a residual signal are made 0according to an encoding method through an analysis of a video ElementStream (ES) included in the first or the second input stream.
 5. Themethod of claim 1, wherein if a P or B picture of the second inputstream after the in-point that refers to a picture before the in-pointis present, the P or B picture is replaced with the virtual P picturestream and a null packet corresponding to a length of a packet isinserted.
 6. The method of claim 1, wherein a Presentation Time Stamp(PTS), a Decoding Time Stamp (DTS), and a time stamp of a Program ClockReference (PCR) of the second input stream after the in-point aremodified so that the PTS, the DTS, and the time stamp become a PTS, aDTS, and a time stamp of a PCR that are continuous based on timeinformation of the first input stream.
 7. The method of claim 6, whereinif the second input stream is a stream of a 3D left image, in switchingfrom the second input stream to a right-image video stream correspondingto the 3D left image, when the switching is performed based on thein-point of the second input stream, a PTS of a picture corresponding tothe in-point of the second input stream is stored, a PTS and DTS of theright-image video stream are modified based on the stored PTS, and a PCRof the right-image video stream is modified based on a PCR of the firstinput stream.
 8. The method of claim 1, further comprising: when secondswitching from the second input stream to the first input stream isperformed after first switching from the first input stream to thesecond input stream, counting a first frame count value that is a numberof frames of the first input stream and a second frame count value thatis a number of frames of the second input stream until a switchingcommand for the second switching is input after the first switching; andcomparing the first frame count value with the second frame count valueand performing the second switching based on a result of the comparison.9. The method of claim 8, wherein if, as a result of the comparison, thesecond frame count value is equal to or greater than the first framecount value, the null packet is inserted between the out-point of thesecond input stream and the in-point of the first input stream by alength of a packet corresponding to a number of frames obtained bysubtracting the second frame count value from the first frame countvalue when performing the second switching.
 10. The method of claim 9,wherein: a picture stream up to the in-point of the first input streamafter the inserted null packet is replaced with the virtual P picturestream, and the length of the packet is set using the null packet. 11.The method of claim 8, wherein if, as a result of the comparison, thefirst frame count value is greater than the second frame count value,the virtual P picture stream is inserted between the out-point of thesecond input stream and the in-point of the first input stream by anumber of packets corresponding to a number of frames obtained bysubtracting the first frame count value from the second frame countvalue when performing the second switching, the first frame count andthe second frame count continue to be performed while inserting andoutputting the virtual P picture stream, and a virtual P picture streamis additionally inserted until the first frame count becomes equal tothe second frame count.
 12. The method of claim 1, wherein switching ofan audio signal from the first input stream to the second input streamis performed by storing a PTS of a picture at which video is switchedand using a point of time at which a PTS of subsequently input audiocorresponds to a PTS at which a picture of the video is switched as aswitching time point.
 13. The method of claim 12, wherein: differentring buffers for the first input stream and the second input stream areconfigured, and time information about each frame included in an audioPacketized Elementary Stream (PES) is calculated based on timeinformation included in the PES, and the calculated time information isstored.
 14. An apparatus of switching a transport stream, comprising: aninput stream reception unit configured to receive a plurality ofdifferent input streams; a switching command input unit configured toreceive a switching command for a first input stream that belongs to theplurality of input streams and that is now output; a search unitconfigured to search for an out-point of the first input stream and anin-point of a second input stream that is newly output, based on theswitching command; an insertion unit configured to insert a virtual Ppicture stream between the out-point and the in-point; and a switchingexecution unit configured to perform switching from the first inputstream into the second input stream based on the out-point and thein-point.
 15. The apparatus of claim 14, wherein the insertion unit isfurther configured to insert the virtual P picture stream by replacing apicture stream of the first input stream from the out-point to thein-point with the virtual P picture stream and fill a null packetcorresponding to a length of the picture stream from the out-point tothe in-point is filled.
 16. The apparatus of claim 14, wherein thevirtual P picture stream comprises a stream in which motion informationof all the macro blocks and a residual signal are made 0 according to anencoding method through an analysis of a video Element Stream (ES)included in the first or the second input stream.
 17. The apparatus ofclaim 14, further comprising a frame counter configured to count a firstframe count value that is a number of frames of the first input streamand a second frame count value that is a number of frames of the secondinput stream until a switching command for second switching is inputafter first switching when the second switching from the second inputstream to the first input stream is performed after the first switchingfrom the first input stream to the second input stream, compare thefirst frame count value with the second frame count value, and performthe second switching based on a result of the comparison.
 18. Theapparatus of claim 17, wherein if, as a result of the comparison, thesecond frame count value is equal to or greater than the first framecount value, the null packet is inserted between the out-point of thesecond input stream and the in-point of the first input stream by alength of a packet corresponding to a number of frames obtained bysubtracting the second frame count value from the first frame countvalue when performing the second switching.
 19. The apparatus of claim17, wherein if, as a result of the comparison, the first frame countvalue is greater than the second frame count value, the virtual Ppicture stream is inserted between the out-point of the second inputstream and the in-point of the first input stream by a number of packetscorresponding to a number of frames obtained by subtracting the firstframe count value from the second frame count value when performing thesecond switching, the first frame count and the second frame countcontinue to be performed while inserting and outputting the virtual Ppicture stream, and a virtual P picture stream is additionally inserteduntil the first frame count becomes equal to the second frame count. 20.A system for switching a transport stream, comprising: a plurality ofencoders configured to generate a plurality of encoded input streams andsend the plurality of encoded input streams; and a transport streamswitching unit configured to receive the plurality of input streams fromthe plurality of encoders and perform switching into a specific inputstream, wherein the transport stream switching unit receives a switchingcommand for a first input stream that belongs to the plurality of inputstreams and that is now output, searches for an out-point of the firstinput stream and an in-point of a second input stream that is newlyoutput, in response to the switching command, inserts a virtual Ppicture stream between the out-point of the first input stream and thein-point of the second input stream, and performs switching from thefirst input stream into the second input stream based on the out-pointand the in-point.